package com.communal.service;

import java.util.List;

import com.communal.model.Model;
import com.communal.util.AppException;
import com.communal.util.CommunalFilterBean;
import com.communal.util.SortPaginationBean;

/**
 * Defines business logic operations for communal records <br>
 * @author Created by andrey.kuznetsov <br>
 * @author Last modified by $Author$ <br>
 * @author Last modified on $Date$ at revision $Revision$ <br>
 * @param <T>
 */
public interface ICRService<T> {

	
	/**
	 * Returns list with all enabled communal records for current model with sorting <br>
	 * @param <T>
	 * @param p_model - current model {@link Model}; <br>
	 * @param p_communalFilterBean - bean with filter information; {@link CommunalFilterBean} <br>
	 * @param p_sortPaginationBean - sorting and pagination holder; {@link SortPaginationBean} <br>
	 * @return {@link List}<{@link communalForm}> <br>
	 * @throws AppException - if exception was occured <br>
	 */
	public List<T> getRecords(Model p_model, CommunalFilterBean p_communalFilterBean, SortPaginationBean p_sortPaginationBean ) throws AppException;
	
	/**
	 * Save new or update existing communal record <br>
	 * @param p_data - json data object; {@link Object} <br>
	 * @param p_model model; {@link Model} <br>
	 * @return list of communal forms; {@link List}<{@link communalForm}> <br>
	 * @throws AppException; {@link AppException} if exception was occurred 
	 */
	public List<T> saveOrUpdateRecord(Object p_data, Model p_model) throws AppException;
	
	/**
	 * Deletes communal record's <br>
	 * @param p_data - json object data; {@link Object} <br>
	 * @param p_model model; {@link Model} <br>
	 * @throws AppException; {@link AppException} if exception was occurred
	 */
	public void deleteRecords(Object p_data, Model p_model) throws AppException;
}
